package com.situ.crm.POI;

import java.io.FileOutputStream;

import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;

public class POITest {

	@Test
	public void testWrite07Excel() throws Exception {
		//创建工作簿
		XSSFWorkbook workbook = new XSSFWorkbook();
		//创建工作表
		XSSFSheet sheet = workbook.createSheet("hello POI");
		//创建行
		XSSFRow row = sheet.createRow(2);
		//创建单元格
		XSSFCell cell = row.createCell(2);
		cell.setCellValue("hello POI!");
		
		//输出Excel到指定位置
		FileOutputStream outputStream = new FileOutputStream("E:\\POI\\工作簿1.xlsx");
		workbook.write(outputStream);
		workbook.close();
		outputStream.close();
	}
}
